import React, { useState, useEffect } from 'react';
import { Button, Divider } from 'antd';

// 代表集合了componentDidMount生命周期函数
export default () => {
  const [count, setCount] = useState(0);

  console.log(1);

  useEffect(() => {
    console.log(2);
  }, []);

  console.log(3);

  // 树苗增加
  const handleIn = () => {
    setCount(count + 1);
    console.log(4);
  };

  return (
    <div>
      {console.log(5)}
      {`当前的树苗数量：${count}`}
      <Divider />
      <Button type="primary" onClick={handleIn}>
        树苗+1
      </Button>
    </div>
  );
};
